export function getIntervalAndframe (scale: number) {
  // 设置不同缩放等级的间隔和帧数间隔
  let interval: number // 秒间隔
  let frameInterval: number | null = null // 帧f
  switch (scale) {
    case 1:
        interval = 5
        break // 00:00, 00:30, 01:00 ...
    case 2:
        interval = 3
        break // 00:00, 00:10, 00:20 ...
    case 3:
        interval = 2
        break // 00:00, 00:01, 00:02 ...
    case 4:
        interval = 1
        break // 00:00, 00:01, 00:02 ...
    case 5:
        interval = 1
        frameInterval = 15
        break // 00:00, 15f, 00:01, 15f ...
    case 6:
        interval = 1
        frameInterval = 10
        break // 00:00, 10f, 20f, 00:01 ...
    case 7:
        interval = 1
        frameInterval = 5
        break // 00:00, 5f, 10f, 15f, ...
    case 8:
        interval = 1
        frameInterval = 3
        break // 00:00, 3f, 6f, ...
    case 9:
        interval = 1
        frameInterval = 2
        break // 00:00, 2f, 4f, ...
    default:
        interval = 1
  }

  return { interval, frameInterval }
}

 // 将秒数转换为"mm:ss"格式
export const formatTimeLabel = (seconds: number) => {
    const minutes = Math.floor(seconds / 60)
    const secs = seconds % 60
    return `${minutes < 10 ? `0${minutes}` : minutes}:${secs < 10 ? `0${secs}` : secs}`
}

// 将移动的距离转换为时间
// @param distance 移动的距离
// @param width 时间轴的宽度
// @returns 移动的时间
export const pxToSecond = (distance: number, width: number): number => {
    return distance / width
}